//引入axios
import request from '@/utils/request';

//引入类型
import type { trademarkResponseData, trademark } from './model/trademark'

//枚举地址
enum API {
    TRADEMARKLIST = '/admin/product/baseTrademark/',//获取全部品牌
    ADDTRADEMARK = '/admin/product/baseTrademark/save',
    UPDATETRADEMARK = '/admin/product/baseTrademark/update',
    DELETETRADEMARK='/admin/product/baseTrademark/remove/'

}

//获取品台数据
export const reqTradeMarkList = (page: number, limit: number) => request.get<any, trademarkResponseData>(API.TRADEMARKLIST + `${page}/${limit}`);

//添加新的品牌与修改已有的品牌数据
export const reqAddOrUpdateTradeMark = (data: trademark) => {
    //修改品牌
    if (data.id) {
        return request.put<any,any>(API.UPDATETRADEMARK, data);
    } else {
        //新增品牌
        return request.post<any,any>(API.ADDTRADEMARK, data);
    }
}
export const reqDeleteTradeMark = (id:number)=>request.delete<any,any>(API.DELETETRADEMARK+id);